//api文件夹用于存放对后台请求的代码
import service from ".";//导入

const teacherApi = {
    //增加
    insert(teacher) {
        //发送axios请求给服务器
        return service.post('/admin/teacher/insert', teacher);
    },
    //根据id删除
    delete(tid) {//删除和根据id查要用反引号
        return service.delete(`/admin/teacher/${tid}`);
    },
    //修改
    update(teacher) {
        return service.put('/admin/teacher/update', teacher);
    },

    //分页查询
    //get请求获取参数
    selectByPage(PageNum, tname) {
        return service.get('/admin/teacher/selectByPage', {
            params: {
                PageNum:PageNum ,
                tname:tname
            }
        });
    },

    //根据id查询
    selectByTid(tid) {
        return service.get(`/admin/teacher/${tid}`);
    },

    //查询所有
    selectAll() {
        return service.get('/admin/teacher');
    },
};

export default teacherApi;//导出